/**
* A wrapper of the DOMEvent object
* @class minjs.Event
*/
/**
* Creates the minjs.Eevent object
* @constructor minjs.Eevent
* @param {DOMEevent} evt - 
*/
minjs.Event = function(evt) {
	if(evt){
		this.getDOMEvent = function(){return evt;}
	}
}

minjs.Event.prototype.getAltKey = function(){
	return this.getDOMEvent().altKey;
}

minjs.Event.prototype.getCtrlKey = function(){
	return this.getDOMEvent().ctrlKey;
}

minjs.Event.prototype.getShiftKey = function(){
	return this.getDOMEvent().shiftKey;
}

minjs.Event.BUTTON = {
	LEFT: 0,
	MIDDLE: 1,
	RIGHT: 2
};

minjs.Event.prototype.getButton = function(){
	return this.getDOMEvent().button;	// in IE7 the value of 'button' is the same as in Firefox; TODO: test IE6
	/*if(!window.minjs){
		return button;
	} else {
		alert(button);
		if(button & 1) return minjs.Event.BUTTON.LEFT;
		if(button & 2) return minjs.Event.BUTTON.RIGHT;
		return minjs.Event.BUTTON.MIDDLE;
	}*/
}

minjs.Event.prototype.getCharCode = function(){
	return window.minjs ? this.getDOMEvent().keyCode : this.getDOMEvent().charCode;
}

minjs.Event.prototype.getClientX = function(){
	return this.getDOMEvent().clientX;
}

minjs.Event.prototype.getClientY = function(){
	return this.getDOMEvent().clientY;
}

minjs.Event.prototype.getLayerX = function(){
	return window.minjs ? this.getDOMEvent().offsetX : this.getDOMEvent().layerX;
}

minjs.Event.prototype.getLayerY = function(){
	return window.minjs ? this.getDOMEvent().offsetY : this.getDOMEvent().layerY;
}

minjs.Event.prototype.getRelatedTarget = function(){
	if(!window.minjs){
		return this.getDOMEvent().relatedTarget;
	} else {
		var type = this.getDOMEvent().type;
		if(type == "mouseover")
			return this.getDOMEvent().fromElement;
		else if(type == "mouseout")
			return this.getDOMEvent().toElement;
		return null;
	}
}

minjs.Event.prototype.getTarget = function(){
	return window.minjs ? this.getDOMEvent().srcElement : this.getDOMEvent().target;
}

minjs.Event.prototype.getType = function(){
	return this.getDOMEvent().type;
}

minjs.Event.prototype.preventDefault = function(){
	var evt = this.getDOMEvent();
	if(evt.preventDefault)
		evt.preventDefault();
	else evt.returnValue = false;
}

minjs.Event.prototype.stopPropagation = function(){
	var evt = this.getDOMEvent();
	if(evt.stopPropagation)
		evt.stopPropagation();
	else evt.cancelBubble();
}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		